package com.demo.sa.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.demo.sa.entity.SysUser;
import com.demo.sa.service.SysUserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/work")
public class WorkingController {
    @Resource
    SysUserService sysUserService;


    // 查询当前用户，浏览器访问： http://localhost:8080/work/getUser?id=1
    @RequestMapping("/getUser")
    public String doLogin(Long id) {
        StpUtil.checkPermissionAnd("user.getUser","user.1","user.2");
        SysUser user = sysUserService.queryById(id);
        return user.getUsername();
    }
}
